UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e/3/abHAdyf/z+J/3h56pJS0lcuD2f0/HrmQD0NX7+M='
WHERE
key_id = 'bd0dea84e20c67f096425c5966f76d938a897a305b89d51a0ce923f21aef5101'
AND (
token = 'e/3/abHAdyf/z+J/3h56pJS0lcuD2f0/HrmQD0NX7+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)