UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f9T8VaAHmeGzUaRaESyRqizgrYUPEemXg3SQwPdfEqk='
WHERE
key_id = '947be7ad8a1c26ec2f05bbc880b82c7bc6724eb7b13f9a60b967e21bdeb79f3f'
AND (
token = 'f9T8VaAHmeGzUaRaESyRqizgrYUPEemXg3SQwPdfEqk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)