UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TClHEpH5eljlrAqnAiusEJ1kG9GBGUe5qEhhkYBzX1k='
WHERE
key_id = '0658fe870e76d5efb29ca87d01e8883301ec3cf4028d118aea9de987675f5840'
AND (
token = 'TClHEpH5eljlrAqnAiusEJ1kG9GBGUe5qEhhkYBzX1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)