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

Query time 0.00043

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(cscart_promotions.from_date > 1783497514,1,0) + if(cscart_promotions.to_date <> 0 and cscart_promotions.to_date < 1783497514,2,0), abs(if(cscart_promotions.from_date > 1783497514,cscart_promotions.from_date,cscart_promotions.to_date) / -1 + 1783497514)",
            "table": {
              "table_name": "cscart_promotions",
              "access_type": "ALL",
              "possible_keys": ["PRIMARY"],
              "rows": 19,
              "filtered": 100,
              "attached_condition": "cscart_promotions.`status` = 'A' and cscart_promotions.promotion_id not in (25,26,27)"
            }
          }
        }
      },
      {
        "table": {
          "table_name": "cscart_promotion_descriptions",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "9",
          "used_key_parts": ["promotion_id", "lang_code"],
          "ref": ["v8.cscart_promotions.promotion_id", "const"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "trigcond(cscart_promotion_descriptions.lang_code = 'vn')"
        }
      },
      {
        "table": {
          "table_name": "cscart_promotion_images",
          "access_type": "eq_ref",
          "possible_keys": ["promo"],
          "key": "promo",
          "key_length": "10",
          "used_key_parts": ["promotion_id", "lang_code"],
          "ref": ["v8.cscart_promotions.promotion_id", "const"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "trigcond(cscart_promotion_images.promotion_id = cscart_promotions.promotion_id and cscart_promotion_images.lang_code = 'vn')"
        }
      }
    ]
  }
}

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
37 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:"in";s:9:"condition";s:10:"categories";s:5:"value";s:0:"";}}} 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:"40";}} 0 0 0 N Y catalog categories= A 0 Khuyến mãi DOUBLE DAY 8/8 <p>Chương trình Double Day 8/8</p> <p>Giảm giá khủng ngày 8/8</p> 37
33 0 a:2:{s:3:"set";s:3:"all";s:9:"set_value";s:1:"1";} a:0:{} 0 0 3 N N catalog A 0 Mua 3 được tặng 1 (được 4) <p>Khi mua 3 gói Café rang xay tặng ngay thêm 1 gói rang xay cùng loại </p> <p>Khi mua 3 gói Café rang xay tặng ngay thêm 1 gói rang xay cùng loại </p> 27
34 0 a:3:{s:3:"set";s:3:"all";s:9:"set_value";s:1:"1";s:10:"conditions";a:2:{i:1;a:3:{s:8:"operator";s:3:"lte";s:9:"condition";s:5:"price";s:5:"value";d:200000;}i:2;a:3:{s:8:"operator";s:2:"in";s:9:"condition";s:10:"categories";s:5:"value";s:15:"297,303,314,315";}}} a:1:{i:1;a:3:{s:5:"bonus";s:14:"order_discount";s:14:"discount_bonus";s:13:"to_percentage";s:14:"discount_value";s:2:"20";}} 0 0 1 N N cart price=200000;categories=297,303,314,315 A 0 Double day 8/8 <p>Big sales 8/8 ngày bùng nổ </p> <p>Big sales 8/8 ngày bùng nổ </p> 29
35 0 a:2:{s:3:"set";s:3:"all";s:9:"set_value";s:1:"1";} a:0:{} 0 0 1 N N cart A 0 Miễn phí giao hàng toàn quốc <p>Miễn phí giao hàng toàn quốc với những đơn hàng từ 1tr đồng&nbsp;</p> <p>Miễn phí giao hàng toàn quốc với những đơn hàng từ 1tr đồng&nbsp;</p> 32
36 0 a:2:{s:3:"set";s:3:"all";s:9:"set_value";s:1:"1";} a:0:{} 0 0 0 N N catalog A 0 Lễ hội Trung Thu <p>Trung Thu đoàn viên </p> 35