UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5FS4EcUZPNGOlKfOw0frota3qPT7DOALgLZ4v+pRUdE='
WHERE
key_id = '58d61ee2b28794ae03c5c64bee14fe172cf8d8966c07c6968e1f7e365e79be60'
AND (
token = '5FS4EcUZPNGOlKfOw0frota3qPT7DOALgLZ4v+pRUdE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)