UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7jXQxyyyN7ccoW04ZiYHtkHwn+2a3Wo1G1b3jBJ1sWY=' 
WHERE 
  key_id = '06451d1e791380604b8f8218e4d9b667cd4fbadb31c9689c681f8e08b832dedf' 
  AND (
    token = '7jXQxyyyN7ccoW04ZiYHtkHwn+2a3Wo1G1b3jBJ1sWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029