UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Y0iA0k1s/0WtIcUb09MI5dEx4+YT/RSlsbG3XyGih4='
WHERE
key_id = 'c40ef273133c27aaf928f12d7df53241fdeed4f565fe08265dc5bb252170b678'
AND (
token = '4Y0iA0k1s/0WtIcUb09MI5dEx4+YT/RSlsbG3XyGih4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)