UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gzIlTYkkhPy+j+i6UOMcef5shruJsON8HIG3Pot7970=' 
WHERE 
  key_id = '8d840a5e702132eb713906af2166b7c620b6e2948c5b8cfdd1b1ba17d5835706' 
  AND (
    token = 'gzIlTYkkhPy+j+i6UOMcef5shruJsON8HIG3Pot7970=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027