UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nUH91DGbbhNy3oOzn3Gcdm/rF9VYq2qg3a6gRWyDgfg=' 
WHERE 
  key_id = '886893f9e124cf90f8175cf174a79a487743e77af43f44a905fd24675c193b67' 
  AND (
    token = 'nUH91DGbbhNy3oOzn3Gcdm/rF9VYq2qg3a6gRWyDgfg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038