UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZF7BaKK6BISK3K5aiUwP3N9q36H4iJEigZ++FABNylE='
WHERE
key_id = '42a3f8b8b06fadd28c18355e82814eee4b5fbd72f442e912edf679f0cc6a2043'
AND (
token = 'ZF7BaKK6BISK3K5aiUwP3N9q36H4iJEigZ++FABNylE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)