UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U0S6EN3DRdPYxLerTQ9K0HxobqOFpFinG21qC65secs='
WHERE
key_id = '10e04e8f597f54f6f43c5f26f87a472b6fc867933b4272555a38054b46e230aa'
AND (
token = 'U0S6EN3DRdPYxLerTQ9K0HxobqOFpFinG21qC65secs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)