UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4RvkO3kTWjiWBag4J7VTVr0J6OvBg+pDciJ91ZRiOqc=' 
WHERE 
  key_id = 'd8d7ccc1a8b57b1293b2710836dc60fd164d48e790026a89e06276c02d06b6ed' 
  AND (
    token = '4RvkO3kTWjiWBag4J7VTVr0J6OvBg+pDciJ91ZRiOqc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052