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