UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'si+E9aG+3s2jBRQKyy/7iCWvpzfwf107qvOJ4b4tGI0='
WHERE
key_id = 'd9c289fb3796a9de8492f2174552e9d7ab5c753d0270671d1db42273b8bb4915'
AND (
token = 'si+E9aG+3s2jBRQKyy/7iCWvpzfwf107qvOJ4b4tGI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)