UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CyWF9fKpBK08/FBKjA32xyKt8FsvpmkvELFJcausE4o=' 
WHERE 
  key_id = 'c3a78a3a3920a00e3271b850113c55d0f081c70b5f64aefe60edb0d460071a24' 
  AND (
    token = 'CyWF9fKpBK08/FBKjA32xyKt8FsvpmkvELFJcausE4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032