MDL-43797 lib/db/upgrade.php: Optimise sql for my_pages deletion

Change-Id: I329ef400cf2e3da80450460901e28061b42b0fd4