UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AmT8YD9klWIz1vZ4LGW7VhKp1kJVAP9oouqsXl9U0IQ='
WHERE
key_id = '6eee34dfc1d790dd15ba26d56a97a3360bbf403e1b69d2e5f6745929c0d7ad10'
AND (
token = 'AmT8YD9klWIz1vZ4LGW7VhKp1kJVAP9oouqsXl9U0IQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)