UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cNF9FgfsR6U0yJYFKS5+a8fgGDB/FcVixMb1hnR+17k=' 
WHERE 
  key_id = '31e1eed9211e73092a8502c808af816ed151292e9945a0bae762b4c6a6493946' 
  AND (
    token = 'cNF9FgfsR6U0yJYFKS5+a8fgGDB/FcVixMb1hnR+17k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016