UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fHQ3gXm7W+nXePYcMYqFzctgxKRfkW2J9JXOSMzLv9U='
WHERE
key_id = '52b86b563d96ca78abd7a4ad654f2ed3fbfc5b5b270454a1c8f034a916d20774'
AND (
token = 'fHQ3gXm7W+nXePYcMYqFzctgxKRfkW2J9JXOSMzLv9U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)