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 = 'ru' 
  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 = 'ru' 
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 (
    1, 2, 9, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14
  ) 
ORDER BY 
  (
    IF(from_date > 1776336977, 1, 0) + IF(
      to_date 
      AND to_date < 1776336977, 
      2, 
      0
    )
  ) asc, 
  ABS(
    (
      IF(
        from_date > 1776336977, from_date, 
        to_date
      )/-1
    ) + 1776336977
  ) asc 
LIMIT 
  0, 12

Query time 0.00241

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "11.03"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "5.47"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_promotion_images",
            "access_type": "system",
            "possible_keys": [
              "promo"
            ],
            "rows_examined_per_scan": 0,
            "rows_produced_per_join": 1,
            "filtered": "0.00",
            "const_row_not_found": true,
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "0.00",
              "data_read_per_join": "16"
            },
            "used_columns": [
              "promotion_image_id",
              "promotion_id",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_promotions",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY"
            ],
            "rows_examined_per_scan": 18,
            "rows_produced_per_join": 1,
            "filtered": "10.00",
            "cost_info": {
              "read_cost": "2.82",
              "eval_cost": "0.18",
              "prefix_cost": "3.00",
              "data_read_per_join": "144"
            },
            "used_columns": [
              "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"
            ],
            "attached_condition": "((`test_uchur_k`.`cscart_promotions`.`status` = 'A') and (`test_uchur_k`.`cscart_promotions`.`promotion_id` not in (1,2,9,3,4,5,6,7,8,10,11,12,13,14)))"
          }
        },
        {
          "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": [
              "test_uchur_k.cscart_promotions.promotion_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.18",
              "prefix_cost": "3.18",
              "data_read_per_join": "1K"
            },
            "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": 16,
            "rows_produced_per_join": 5,
            "filtered": "19.00",
            "using_index": true,
            "using_join_buffer": "hash join",
            "cost_info": {
              "read_cost": "1.82",
              "eval_cost": "0.55",
              "prefix_cost": "5.55",
              "data_read_per_join": "87"
            },
            "used_columns": [
              "storefront_id",
              "promotion_id"
            ],
            "attached_condition": "(<if>(found_match(storefronts_promotions), ((`test_uchur_k`.`storefronts_promotions`.`storefront_id` = 1) or (`test_uchur_k`.`storefronts_promotions`.`storefront_id` is null)), true) and <if>(is_not_null_compl(storefronts_promotions), (`test_uchur_k`.`storefronts_promotions`.`promotion_id` = `test_uchur_k`.`cscart_promotions`.`promotion_id`), true))"
          }
        }
      ]
    }
  }
}