It’s probably possible but it would take some work and experimentation. Could you create cron job that is continually checking to see if Openfire is running and as soon as it detects that it isn’t update the necessary table? Or somehow modify the Openfire startup script to do the necessary updates after the shutdown command has been issued?
Another option would be to write a plugin that uses the XMPPServerListener which could detect when the server is shutting down and do the necessary updates prior to shutdown.