UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '42NDsP1dXVWYY3wHh6QRRzE57I+GA6Kld5BxHESdoV8='
WHERE
key_id = '31034ae3e86a7c45ae180f9740c29ea7611eb81cfcd632735fbcd86cfedb6f65'
AND (
token = '42NDsP1dXVWYY3wHh6QRRzE57I+GA6Kld5BxHESdoV8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)