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