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