UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aOO6VoRiEIOC6+BlEXjkI3nHaLR+pM1FfN9rhE9kjOM=' 
WHERE 
  key_id = '709154d1061bc50195ce1693f8ab782a9256482e271284058082eb9122c488fc' 
  AND (
    token = 'aOO6VoRiEIOC6+BlEXjkI3nHaLR+pM1FfN9rhE9kjOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047