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 = 'en' 
  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 <= 1761549308, 
    1
  ) 
  AND IF(to_date, to_date >= 1761549308, 1) 
  AND status IN ('A', 'H') 
  AND cscart_promotions.zone = 'catalog' 
  AND (
    storefronts_promotions.storefront_id = 1 
    OR storefronts_promotions.storefront_id IS NULL
  ) 
  AND (
    cscart_promotions.company_id IN (
      26, 80, 85, 86, 87, 88, 89, 90, 91, 101, 
      102, 103, 104
    ) 
    OR cscart_promotions.company_id = 0
  ) 
ORDER BY 
  cscart_promotions.stop_other_rules desc, 
  cscart_promotions.priority asc

Query time 0.00032

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "13.55"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "11.00"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_promotions",
            "access_type": "ALL",
            "rows_examined_per_scan": 6,
            "rows_produced_per_join": 1,
            "filtered": "16.67",
            "cost_info": {
              "read_cost": "0.75",
              "eval_cost": "0.10",
              "prefix_cost": "0.85",
              "data_read_per_join": "80"
            },
            "used_columns": [
              "promotion_id",
              "company_id",
              "conditions",
              "bonuses",
              "to_date",
              "from_date",
              "priority",
              "stop",
              "zone",
              "conditions_hash",
              "status",
              "number_of_usages",
              "users_conditions_hash",
              "stop_other_rules"
            ],
            "attached_condition": "((0 <> if(`shoptheindependents_com`.`cscart_promotions`.`from_date`,(`shoptheindependents_com`.`cscart_promotions`.`from_date` <= 1761549308),1)) and (0 <> if(`shoptheindependents_com`.`cscart_promotions`.`to_date`,(`shoptheindependents_com`.`cscart_promotions`.`to_date` >= 1761549308),1)) and (`shoptheindependents_com`.`cscart_promotions`.`status` in ('A','H')) and (`shoptheindependents_com`.`cscart_promotions`.`zone` = 'catalog') and ((`shoptheindependents_com`.`cscart_promotions`.`company_id` in (26,80,85,86,87,88,89,90,91,101,102,103,104)) or (`shoptheindependents_com`.`cscart_promotions`.`company_id` = 0)))"
          }
        },
        {
          "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": [
              "shoptheindependents_com.cscart_promotions.promotion_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.25",
              "eval_cost": "0.10",
              "prefix_cost": "1.20",
              "data_read_per_join": "800"
            },
            "used_columns": [
              "promotion_id",
              "name",
              "short_description",
              "detailed_description",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "storefronts_promotions",
            "access_type": "index",
            "key": "idx_storefront_id",
            "used_key_parts": [
              "storefront_id"
            ],
            "key_length": "4",
            "rows_examined_per_scan": 11,
            "rows_produced_per_join": 11,
            "filtered": "100.00",
            "using_index": true,
            "using_join_buffer": "hash join",
            "cost_info": {
              "read_cost": "0.25",
              "eval_cost": "1.10",
              "prefix_cost": "2.55",
              "data_read_per_join": "176"
            },
            "used_columns": [
              "storefront_id",
              "promotion_id"
            ],
            "attached_condition": "(<if>(found_match(storefronts_promotions), ((`shoptheindependents_com`.`storefronts_promotions`.`storefront_id` = 1) or (`shoptheindependents_com`.`storefronts_promotions`.`storefront_id` is null)), true) and <if>(is_not_null_compl(storefronts_promotions), (`shoptheindependents_com`.`storefronts_promotions`.`promotion_id` = `shoptheindependents_com`.`cscart_promotions`.`promotion_id`), true))"
          }
        }
      ]
    }
  }
}