UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MNr9CkhpPnh48l72y08SL9VEuOBwcoLSii4Kt37VMok='
WHERE
key_id = 'f20dfa0aaab6544c3b0411a6aff79c665aa78455d80d67bea4ce584a5b9097fd'
AND (
token = 'MNr9CkhpPnh48l72y08SL9VEuOBwcoLSii4Kt37VMok='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)