Redmine #6611: Fix incorrect key extraction when upgrading from < 3.6.1

Versions before 3.6.1 don't have the appsettings.php secret key at
all, so we need to detect when our extraction has failed and delete
the key file so that we will generate a key instead. We do this by
matching the extracted key file against the regular expression and by
making sure it contains exactly one such line.
Why not use the exact set of characters from the UUID creation?
```tr -dc 'a-zA-Z0-9' ```
so it should be 
```UUID_REGEX="[a-zA-Z0-9]{32}"```