UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VQd2JdPwk6mVmcWroxcmJxT3/xPFJ9Iw9AAiBO+h8aw='
WHERE
key_id = 'bbed596b6ce3eb6fbff9039e0d8d695f6a49bfe803ed53c0be3e17c5c365aaa7'
AND (
token = 'VQd2JdPwk6mVmcWroxcmJxT3/xPFJ9Iw9AAiBO+h8aw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)