UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mWM832Z7u2AB0NnhUkziDx9bh96whl50NV43V6L4LIE=' 
WHERE 
  key_id = '30f2f435109d16f57a81f27c6171304acf78bf16ccdc34bf4ed6e13c638b8a68' 
  AND (
    token = 'mWM832Z7u2AB0NnhUkziDx9bh96whl50NV43V6L4LIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040