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