UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v+jmBdxxrduKIRLI0MaeIE6WOWJNccKDTXNC3SjiKJc='
WHERE
key_id = 'a6be07633f8bc7599c4015618462edeb961d448b14bf0ece883aa18d2bd7febc'
AND (
token = 'v+jmBdxxrduKIRLI0MaeIE6WOWJNccKDTXNC3SjiKJc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)