UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ux6XS3M1rvHIETVxviBdn9ApXcWMeD9kmHyLpVOFHCg='
WHERE
key_id = '22c6b5ce8331393f480869327d63843807a4a635b4ec22eae01d5a8b729a0a16'
AND (
token = 'ux6XS3M1rvHIETVxviBdn9ApXcWMeD9kmHyLpVOFHCg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)