UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aAESy1j2c1pSovS113iKjcg3KBWQMsaBit9475ON3Xo='
WHERE
key_id = 'fee654cf66925151faaef37e97af672fe3f4ace841ce7c6bf389a395db3ecefa'
AND (
token = 'aAESy1j2c1pSovS113iKjcg3KBWQMsaBit9475ON3Xo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)