SELECT 
  cscart_promotions.*, 
  cscart_promotion_descriptions.name, 
  cscart_promotion_descriptions.detailed_description, 
  cscart_promotion_descriptions.short_description 
FROM 
  cscart_promotions 
  LEFT JOIN cscart_promotion_descriptions ON cscart_promotion_descriptions.promotion_id = cscart_promotions.promotion_id 
  AND cscart_promotion_descriptions.lang_code = 'fr' 
  LEFT JOIN cscart_storefronts_promotions AS storefronts_promotions ON storefronts_promotions.promotion_id = cscart_promotions.promotion_id 
WHERE 
  1 
  AND IF(
    from_date, from_date <= 1729589256, 
    1
  ) 
  AND IF(to_date, to_date >= 1729589256, 1) 
  AND status IN ('A', 'H') 
  AND cscart_promotions.zone = 'catalog' 
  AND (
    storefronts_promotions.storefront_id = 1 
    OR storefronts_promotions.storefront_id IS NULL
  ) 
ORDER BY 
  cscart_promotions.stop_other_rules desc, 
  cscart_promotions.priority asc

Query time 0.00398

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "357.77"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "281.88"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_promotions",
            "access_type": "ALL",
            "rows_examined_per_scan": 27,
            "rows_produced_per_join": 2,
            "filtered": "10.00",
            "cost_info": {
              "read_cost": "12.77",
              "eval_cost": "0.54",
              "prefix_cost": "13.31",
              "data_read_per_join": "216"
            },
            "used_columns": [
              "promotion_id",
              "conditions",
              "bonuses",
              "to_date",
              "from_date",
              "priority",
              "stop",
              "zone",
              "conditions_hash",
              "status",
              "number_of_usages",
              "company_id",
              "users_conditions_hash",
              "stop_other_rules"
            ],
            "attached_condition": "(if(`ea201_diorama`.`cscart_promotions`.`from_date`,(`ea201_diorama`.`cscart_promotions`.`from_date` <= 1729589256),1) and if(`ea201_diorama`.`cscart_promotions`.`to_date`,(`ea201_diorama`.`cscart_promotions`.`to_date` >= 1729589256),1) and (`ea201_diorama`.`cscart_promotions`.`status` in ('A','H')) and (`ea201_diorama`.`cscart_promotions`.`zone` = 'catalog'))"
          }
        },
        {
          "table": {
            "table_name": "cscart_promotion_descriptions",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "promotion_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "ea201_diorama.cscart_promotions.promotion_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 2,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.70",
              "eval_cost": "0.54",
              "prefix_cost": "16.55",
              "data_read_per_join": "2K"
            },
            "used_columns": [
              "promotion_id",
              "name",
              "short_description",
              "detailed_description",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "storefronts_promotions",
            "access_type": "index",
            "key": "PRIMARY",
            "used_key_parts": [
              "storefront_id",
              "promotion_id"
            ],
            "key_length": "8",
            "rows_examined_per_scan": 108,
            "rows_produced_per_join": 281,
            "filtered": "96.67",
            "using_index": true,
            "using_join_buffer": "Block Nested Loop",
            "cost_info": {
              "read_cost": "2.96",
              "eval_cost": "56.38",
              "prefix_cost": "75.89",
              "data_read_per_join": "4K"
            },
            "used_columns": [
              "storefront_id",
              "promotion_id"
            ],
            "attached_condition": "(<if>(found_match(storefronts_promotions), ((`ea201_diorama`.`storefronts_promotions`.`storefront_id` = 1) or isnull(`ea201_diorama`.`storefronts_promotions`.`storefront_id`)), true) and <if>(is_not_null_compl(storefronts_promotions), (`ea201_diorama`.`storefronts_promotions`.`promotion_id` = `ea201_diorama`.`cscart_promotions`.`promotion_id`), true))"
          }
        }
      ]
    }
  }
}

Result

promotion_id conditions bonuses to_date from_date priority stop zone conditions_hash status number_of_usages company_id users_conditions_hash stop_other_rules name detailed_description short_description
530 a:3:{s:3:"set";s:3:"all";s:9:"set_value";s:1:"1";s:10:"conditions";a:1:{i:1;a:3:{s:8:"operator";s:2:"in";s:9:"condition";s:10:"categories";s:5:"value";s:3:"706";}}} a:1:{i:1;a:3:{s:5:"bonus";s:16:"product_discount";s:14:"discount_bonus";s:13:"by_percentage";s:14:"discount_value";s:2:"20";}} 1730415599 1727042400 0 Y catalog categories=706 A 9 1 N Promotions -20% du 23/09 au 31/10