Condition to toggle light depending on the state of another light

I have separate light switches for the hallway on each level of my house (basement, ground floor and second floor), Separate to this I have light switches at the staircases to control the light on the upstairs and downstairs. All light switches are planned to be extended with a shelly device to be able to control them also via home assistant.

Now it sometimes happens that the hallway light on the second floor has been turned on. You have enough light to walk downstairs and arriving at ground level you recognize you cannot turn off the light. So I would like to add this opportunity. The idea is to long-click the stairways light switch to toggle the hallway light on the second floor.

  ##########################################################
  ## Toggle Upwards Stairs Light
  ##
  ## Shelly is in detached mode to not switch power, 
  ## but control via staircase lighting via Zigbee protocol instead
  ##########################################################
- alias: Light - Toggle Upwards Stairs Light
  id: 'Light_toggle_upwards_stairs_light'
  trigger:
    platform: event
    event_type: shelly.click
    event_data:
      device: shellyswitch25-84CCA89F70DD #Shelly 2.5 Flur OG
      channel: 2 #Channel 2=Staircase
      click_type: single
  action:
    service: light.toggle
    target:
      entity_id: light.staircase_up

  ##########################################################
  ## Toggle Upstairs Corridor Lights from Staircase Switch
  ##########################################################
- alias: Light - Toggle Upstairs Corridor Lights
  id: 'Light_toggle_upstairs_corridor_lights'
  trigger:
    platform: event
    event_type: shelly.click
    event_data:
      device: shellyswitch25-84CCA89F70DD #Shelly 2.5 Flur OG
      channel: 2 #Channel 2=Staircase
      click_type: long
  action:
    service: light.toggle
    target:
      entity_id: light.corridor_upstairs

Towards the basement I would like to allways turn on the basement corridor light light.corridor_basement, when the light switch for the downstairs lighting is pressed. But the basement corridor light should remain to be controlled separatley from the downstairs lighting.

  ##########################################################
  ## Toggle Downwards Stairs Light
  ##
  ## Shelly is in detached mode to not switch power, 
  ## but control via staircase lighting via Zigbee protocol instead
  ##########################################################
- alias: Light - Toggle Downwards Stairs Light
  id: 'Light_toggle_downwards_strais_light'
  trigger:
    platform: event
    event_type: shelly.click
    event_data:
      device: shellyswitch25-84CCA89FCDC7 #Shelly 2.5 Flur UG
      channel: 2 #Channel 2=Staircase
      click_type: single
  action:
    service: light.toggle
    target:
      entity_id: 
        - light.staircase_down
#        - light.corridor_basement #TBD Ensure that it toggles to the same state!

i.e. the light.corridor_basement only needs to be toggled, if it is in the same state than the light.staircase_down. Is there anyway to add this condition priort to calling the toggle of light.corridor_basement ?