How does the AND/Or logic work when I have AND as well as OR?

For example, I want a file to exist as well as (a registry value to not be
the latest version, or the registry key to not exist).

The flag file is a flag indicating that the system is one for which this
setup.exe should be launched upon. If it doesn't exist, I don't want to
run this Zenapp.



I'll be overly simplistic for conversation. These aren't the real files/keys.



For a zenapp to run,
I want c:\a.flag to exist
AND
(HKLM\somereg\value to != 1.2.4 or HKLM\somereg key to not exist)


How do I code that Zenworks?
Do I do;

C:\a.flag exists
and HKLM\somereg\value to != 1.2.4
or C:\a.flag exists
and HKLM\somereg key to not exist


or do I do it this way

C:\a.flag exists
and HKLM\somereg\value to != 1.2.4
or HKLM\somereg key to not exist


My concern is that the second way would launch
if HKLM\somereg key doesn't exist regardless of the a.flag existing or not.

So how does this work? Thanks.