Fixes #5002 unlocking the upgrade before forwarding to upgrade script