UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7/fsH4IxlD0ZSuD9PtwTzcPjPq8ywPOVPsreJ78ZvRA=' 
WHERE 
  key_id = 'd1d7872c4da74305a466b78c5a60b958604bba27d5e8e5bf46c31d6705b7b39f' 
  AND (
    token = '7/fsH4IxlD0ZSuD9PtwTzcPjPq8ywPOVPsreJ78ZvRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047