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

Change-Id: Ibf8da394e3357fdde351eac49627539eb412e247