[TASK] Speed up updating the extension list

The process of updating the TER
extension list takes approx 1 minute
because the extension manager needs
to mark all "latest versions". This is done
via a large UPDATE query on fields
without indices, additionally this is done
in PHP and not in SQL with a
simple subselect.

Additionally the SQL file does not set
appropriate indices at all, which is also
done in this patch.

Releases: 6.2
Resolves: #56354
Change-Id: Ic46994fa1b16cce9912950520955185f3f95fe1a
Reviewed-on: https://review.typo3.org/27876
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel