SELECT 
  netting_promotions.*, 
  netting_promotion_descriptions.name, 
  netting_promotion_descriptions.detailed_description, 
  netting_promotion_descriptions.short_description, 
  netting_promotion_images.promotion_image_id 
FROM 
  netting_promotions 
  LEFT JOIN netting_promotion_descriptions ON netting_promotion_descriptions.promotion_id = netting_promotions.promotion_id 
  AND netting_promotion_descriptions.lang_code = 'es' 
  LEFT JOIN netting_storefronts_promotions AS storefronts_promotions ON storefronts_promotions.promotion_id = netting_promotions.promotion_id 
  LEFT JOIN netting_promotion_images ON netting_promotion_images.promotion_id = netting_promotions.promotion_id 
  AND netting_promotion_images.lang_code = 'es' 
WHERE 
  1 
  AND status IN ('A') 
  AND (
    storefronts_promotions.storefront_id = 1 
    OR storefronts_promotions.storefront_id IS NULL
  ) 
  AND netting_promotions.promotion_id NOT IN (25, 26, 27) 
  AND 1 
ORDER BY 
  (
    IF(from_date > 1743856955, 1, 0) + IF(
      to_date 
      AND to_date < 1743856955, 
      2, 
      0
    )
  ) asc, 
  ABS(
    (
      IF(
        from_date > 1743856955, from_date, 
        to_date
      )/-1
    ) + 1743856955
  ) asc 
LIMIT 
  0, 12

Query time 0.00053

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "storefronts_promotions",
          "access_type": "system",
          "possible_keys": ["PRIMARY", "idx_storefront_id"],
          "rows": 0,
          "filtered": 0,
          "const_row_not_found": true
        }
      },
      {
        "read_sorted_file": {
          "filesort": {
            "sort_key": "if(netting_promotions.from_date > 1743856955,1,0) + if(netting_promotions.to_date <> 0 and netting_promotions.to_date < 1743856955,2,0), abs(if(netting_promotions.from_date > 1743856955,netting_promotions.from_date,netting_promotions.to_date) / -1 + 1743856955)",
            "table": {
              "table_name": "netting_promotions",
              "access_type": "ALL",
              "possible_keys": ["PRIMARY"],
              "rows": 6,
              "filtered": 100,
              "attached_condition": "netting_promotions.`status` = 'A' and netting_promotions.promotion_id not in (25,26,27)"
            }
          }
        }
      },
      {
        "table": {
          "table_name": "netting_promotion_descriptions",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "9",
          "used_key_parts": ["promotion_id", "lang_code"],
          "ref": ["pucuda_cscart.netting_promotions.promotion_id", "const"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "trigcond(netting_promotion_descriptions.lang_code = 'es')"
        }
      },
      {
        "table": {
          "table_name": "netting_promotion_images",
          "access_type": "eq_ref",
          "possible_keys": ["promo"],
          "key": "promo",
          "key_length": "10",
          "used_key_parts": ["promotion_id", "lang_code"],
          "ref": ["pucuda_cscart.netting_promotions.promotion_id", "const"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "trigcond(netting_promotion_images.promotion_id = netting_promotions.promotion_id and netting_promotion_images.lang_code = 'es')"
        }
      }
    ]
  }
}

Result

promotion_id company_id conditions bonuses to_date from_date priority stop stop_other_rules zone conditions_hash status number_of_usages users_conditions_hash name detailed_description short_description promotion_image_id
15 0 a:3:{s:3:"set";s:3:"all";s:9:"set_value";s:1:"1";s:10:"conditions";a:1:{i:3;a:3:{s:8:"operator";s:2:"in";s:9:"condition";s:8:"products";s:5:"value";a:1:{i:728177203;a:3:{s:3:"aoc";s:1:"N";s:10:"product_id";s:3:"408";s:6:"amount";s:1:"1";}}}}} a:1:{i:1;a:3:{s:5:"bonus";s:14:"order_discount";s:14:"discount_bonus";s:13:"by_percentage";s:14:"discount_value";s:2:"20";}} 1740805199 1736226000 3 N N cart products=728177203 A 5 20% discount coupon <p>Get 20% off your order with the bonus code "sale-20"</p> 11
18 0 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:"eq";s:9:"condition";s:11:"coupon_code";s:5:"value";s:10:"netting-10";}}} a:1:{i:1;a:3:{s:5:"bonus";s:14:"order_discount";s:14:"discount_bonus";s:13:"by_percentage";s:14:"discount_value";s:2:"10";}} 1738299599 1736226000 5 N N cart coupon_code=netting-10 A 0 DEMO Store discount <p>10% off our entire range of products</p> 12