UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JOG1j8qz+g8STj22w6t/SIAUgiG5aDmppAEFR3IF0aQ='
WHERE
key_id = 'a2ceb874c06af83dab0dd616e9832f9e0fb79c7e85eee64a021109b3694ada3b'
AND (
token = 'JOG1j8qz+g8STj22w6t/SIAUgiG5aDmppAEFR3IF0aQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)