UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XMWkZG9PNJ3sfNsN/x/nQVS3L83HQxMX7HL9gO337pE='
WHERE
key_id = '7f877d4989646973d6bcc6fe02314622dcca890dcbebd927d63d667eb934448b'
AND (
token = 'XMWkZG9PNJ3sfNsN/x/nQVS3L83HQxMX7HL9gO337pE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)