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