Apple - Can I update iOS on a locked phone?
You cannot update iOS on a locked device. When you try to update via iTunes(which is the only possible in this situation), it will ask you to unlock the iPhone. It is simply not possible to update or restore a locked iPhone or any iOS device.
Update: I have discussed this with someone who has specifically tried this. I now understand what happens here.
The answer is no, with one notable exception.
Having looked through Apple's documentation, I have found conflicting information.
First, the iOS Security Guide describes going into Device Firmware Upgrade (DFU) mode and Recovery mode. It states that from either mode, the device must be restored to factory default settings. However, that is in direct conflict with the link it provides to recovery mode.
The Link from the iOS security guide puts you on this Apple support page. On this page it states that if you choose the Update option,
iTunes will try to reinstall iOS without erasing your data.
I now know this line to be a simplification. In this scenario, when iTunes reinstalls iOS, it's only option is to restore the iPhone to factory default settings.
If you have logged into your phone but haven't rebooted it, and you have previously synced it via iTunes, you can backup the contents using the same computer. So in this case iTunes will backup the contents, reinstall iOS with a restore to factory default settings, then restore the contents from the backup.
Once the iPhone is rebooted, you can only restore to factory default settings. You can restore the contents of a previously made backup, but you cannot backup the data from the phone.