Use an and node like the guy below me said and then make sure that the only one who performs the check is the last light. In what class is the code you showed us?
I would include 2 booleans in the lights. An “On” and a “TurnedOnFirst” variable. When a light is turned on, check to see if the other light is turned on, if the other light is off also turn on the “TurnedOnFirst” variable. Then just check to see if LightA “On” and “TurnedOnFirst” are true. Just make sure to turn both variables off when you turn off the light.