UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vcc1H44+br778NgXsQXjCWE3gGtCar9RgvBOOVvngWQ=' 
WHERE 
  key_id = '06233f92fd24e07654e4f7e986576489bfbc46d7ff4d1047fc2df67e16f8d4bd' 
  AND (
    token = 'Vcc1H44+br778NgXsQXjCWE3gGtCar9RgvBOOVvngWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026