UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lUAL9e+OobP1tPeJ7GGgRVSt6tOiVb7qqcovUPxA9ok='
WHERE
key_id = '1e682fd6ea45d840988425cae8c2b216f7e5ccc0e747c559360e032d65c56e98'
AND (
token = 'lUAL9e+OobP1tPeJ7GGgRVSt6tOiVb7qqcovUPxA9ok='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)