Configuring actions for light group

I have two lights in my living room, under a a group - with a single press on a aqara button/switch, I turn on and off on of them, with double click I turn on/off both of them.

For one:

alias: Toggle Luz Sala
description: ''
trigger:
  - platform: event
    event_type: xiaomi_aqara.click
    event_data:
      entity_id: binary_sensor.switch_158d0001d62b0d
condition: []
action:
  - service: light.toggle
    target:
      entity_id: light.luz
mode: single

For both:

alias: Toggle Luz Sala (Duplicate)
description: ''
trigger:
  - platform: event
    event_type: xiaomi_aqara.click
    event_data:
      entity_id: binary_sensor.switch_158d0001d62b0d
      click_type: double
condition: []
action:
  - service: light.toggle
    target:
      entity_id: light.luzes_sala
mode: single

Now, what I really would like, is to when both are on, click the button one time turn both off (right now, I have to click two times).

I could create a third automation, but what I really would like, is to have a single automation for all this.

Is it possible?

Yes it is. Use the choose action, the conditions will be the light states:

https://www.home-assistant.io/docs/scripts#choose-a-group-of-actions