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

Change-Id: Idf300ab07afda3bcefea80e617549f40c710e529