UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9FkugRRz8f9Y70YdgMy2MyPanz0WF6w03FxPkVkmOW0='
WHERE
key_id = '378b738753f4bc7697f7feeace025e8c68ae5a2867bf09da08f4abc25ec07895'
AND (
token = '9FkugRRz8f9Y70YdgMy2MyPanz0WF6w03FxPkVkmOW0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)