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

Query time 0.00032