UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '17uZUHZFEOQcoST2tOU5ddFyS7ZMEw5y61AQ2w9gOyQ='
WHERE
key_id = '5f0140e8750c001aaab729c87e43c79ccd4e86ab99c0efcd610810f9b9fb9907'
AND (
token = '17uZUHZFEOQcoST2tOU5ddFyS7ZMEw5y61AQ2w9gOyQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)