UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lrerzIchqHEk02PEEXnQ7O9CIN+F/eU/SSkWwX8R6TA='
WHERE
key_id = '7865f09621962a964a6a677810ed96de30b4b5431e28bd62b990e59121bbf6f5'
AND (
token = 'lrerzIchqHEk02PEEXnQ7O9CIN+F/eU/SSkWwX8R6TA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)