SELECT 
  SQL_CALC_FOUND_ROWS products.product_id, 
  descr1.product as product, 
  companies.company as company_name, 
  products.product_type, 
  products.parent_product_id, 
  cscart_product_review_prepared_data.average_rating average_rating, 
  cscart_product_review_prepared_data.reviews_count product_reviews_count 
FROM 
  cscart_products as products 
  LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'vi' 
  LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id 
  AND prices.lower_limit = 1 
  LEFT JOIN cscart_companies AS companies ON companies.company_id = products.company_id 
  INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id 
  INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id 
  LEFT JOIN cscart_product_review_prepared_data ON cscart_product_review_prepared_data.product_id = products.product_id 
  AND cscart_product_review_prepared_data.storefront_id = 0 
  LEFT JOIN cscart_product_popularity as popularity ON popularity.product_id = products.product_id 
WHERE 
  1 
  AND companies.status IN ('A') 
  AND (
    products.amount > 0 
    OR products.tracking = 'D'
  ) 
  AND (
    products.usergroup_ids = '' 
    OR FIND_IN_SET(0, products.usergroup_ids) 
    OR FIND_IN_SET(1, products.usergroup_ids)
  ) 
  AND products.status IN ('A') 
  AND prices.usergroup_id IN (0, 0, 1) 
  AND (
    (
      1 
      AND products.product_id IN (
        49588, 48042, 48849, 2966, 1123, 4262, 
        49361, 585, 1104, 40235, 1894, 2252, 
        2507, 856, 27357, 49164, 48839, 40153
      )
    ) 
    AND companies.status IN ('A') 
    AND prices.usergroup_id IN (0, 0, 1)
  ) 
GROUP BY 
  products.product_id 
ORDER BY 
  popularity.total desc, 
  products.product_id ASC

Query time 0.00818

JSON explain

{
  "query_block": {
    "select_id": 1,
    "filesort": {
      "sort_key": "popularity.total desc, products.product_id",
      "temporary_table": {
        "nested_loop": [
          {
            "table": {
              "table_name": "products",
              "access_type": "range",
              "possible_keys": ["PRIMARY", "status"],
              "key": "PRIMARY",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "rows": 18,
              "filtered": 52.06833649,
              "index_condition": "products.product_id in (49588,48042,48849,2966,1123,4262,49361,585,1104,40235,1894,2252,2507,856,27357,49164,48839,40153)",
              "attached_condition": "(products.amount > 0 or products.tracking = 'D') and (products.usergroup_ids = '' or find_in_set(0,products.usergroup_ids) or find_in_set(1,products.usergroup_ids)) and products.`status` = 'A'"
            }
          },
          {
            "table": {
              "table_name": "descr1",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY", "product_id"],
              "key": "PRIMARY",
              "key_length": "11",
              "used_key_parts": ["product_id", "lang_code"],
              "ref": ["dev_db.products.product_id", "const"],
              "rows": 1,
              "filtered": 100,
              "attached_condition": "trigcond(descr1.lang_code = 'vi')"
            }
          },
          {
            "table": {
              "table_name": "companies",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY"],
              "key": "PRIMARY",
              "key_length": "4",
              "used_key_parts": ["company_id"],
              "ref": ["dev_db.products.company_id"],
              "rows": 1,
              "filtered": 100,
              "attached_condition": "companies.`status` = 'A'"
            }
          },
          {
            "table": {
              "table_name": "cscart_product_review_prepared_data",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY"],
              "key": "PRIMARY",
              "key_length": "7",
              "used_key_parts": ["product_id", "storefront_id"],
              "ref": ["dev_db.products.product_id", "const"],
              "rows": 1,
              "filtered": 100
            }
          },
          {
            "table": {
              "table_name": "popularity",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY", "total"],
              "key": "PRIMARY",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "ref": ["dev_db.products.product_id"],
              "rows": 1,
              "filtered": 100
            }
          },
          {
            "table": {
              "table_name": "prices",
              "access_type": "ref",
              "possible_keys": [
                "usergroup",
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "key": "product_id",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "ref": ["dev_db.products.product_id"],
              "rows": 1,
              "filtered": 99.9960556,
              "attached_condition": "prices.lower_limit = 1 and prices.usergroup_id in (0,0,1) and prices.usergroup_id in (0,0,1)"
            }
          },
          {
            "table": {
              "table_name": "products_categories",
              "access_type": "ref",
              "possible_keys": ["PRIMARY", "pt"],
              "key": "pt",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "ref": ["dev_db.products.product_id"],
              "rows": 1,
              "filtered": 100
            }
          },
          {
            "table": {
              "table_name": "cscart_categories",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY", "p_category_id"],
              "key": "PRIMARY",
              "key_length": "3",
              "used_key_parts": ["category_id"],
              "ref": ["dev_db.products_categories.category_id"],
              "rows": 1,
              "filtered": 100,
              "using_index": true
            }
          }
        ]
      }
    }
  }
}

Result

product_id product company_name product_type parent_product_id average_rating product_reviews_count
48839 Tượng Gỗ Khắc Tên Gia Đình Mèo Made in Vietnam, Mang Đến Sự Ấm Áp Và Hạnh Phúc, Đồ Trang Trí Custom, Quà Tặng Gia Đình Ý Nghĩa, Quà Tặng Cá Nhân Hóa Chus - Love from Vietnam P 0 5.00 22
49588 Bật Lửa Nghệ Thuật Khắc Tên Theo Yêu Cầu, Bật Lửa Cổ Điển Bọc Da Vẽ Tay Hoạ Tiết Việt Nam, Quà Tặng Việt Nam, Quà Tặng Độc Đáo MINH Leather VN P 0 0
49164 Sổ Tay Bìa Vải Handmade Phiên Bản Giới Hạn, CHUS x Pilgrim Notebook, Quà Tặng Đẳng Cấp Cho Những Ai Giàu Kiến Thức - Kinh Nghiệm - Trải Nghiệm Chus - Love from Vietnam P 0 5.00 10
1894 Bút Gỗ Sưa Khắc Tên (Kèm Hộp), Màu Đỏ Nâu Sang Trọng, Thanh Lịch và Sang Trọng, Kỹ Thuật Khắc Tên Tỉ Mỉ, Bút Viết Cao Cấp Tamy Beloved P 0 5.00 14
1104 Trà Ướp Hoa Ngâu, Trà Hữu Cơ, Trồng Và Thu Hoạch Bằng Tay, Công Nghệ Hữu Cơ, Nông Sàn Địa Phương, Trà Việt Nam SACHSTEA 1773 P 0 5.00 11
856 Vòng Tay Trầm Hương Mắc Trúc, Thiết Kế Mới Lạ, Hương Thơm Đặc Trưng Của Trầm Hương, Cải Thiện Sức Khỏe, Đẩy Lùi Những Cảm Xúc Tiêu Cực Tinh Agarwood P 0 0
27357 Tranh Hoa Khô Custom Thông Điệp, Mẫu Viền Hoa Khô, Tranh Trang Trí Độc Đáo, Quà Cưới Hoàn Hảo, Quà Tặng Người Yêu, Quà Tặng Tinh Tế Muối Concept P 0 5.00 10
1123 Combo 3 Sản Phẩm Chăm Sóc Da, Combo Chăm Sóc Da Cho Nam, Skincare Cho Da Dầu Mụn, Mỹ Phẩm Thuần Chay Men Stay Simplicity P 0 5.00 7
2966 Bia Craft Chai Tê Tê White Ale, Hương Vị Thanh Tao Và Ngọt Mát, Sử Dụng Nguyên Liệu Tự Nhiên, Vị Đắng Nhẹ Nhàng, Dễ Chịu Khi Thưởng Thức TÊ TÊ BREWING P 0 4.88 8
2507 Bia Craft East West Pale Ale, Chai 330ml, Bia Craft Thủ Công, Bia Ủ Cao Cấp, Mùi Thơm Đặc Trưng, Vị Ngon Thuần Túy East West Brewing & Dalat Cider P 0 4.88 5
40153 Bật Lửa Mini Thiết Kế Nghệ Thuật, Bật Lửa Nhỏ Gọn và Tiện Lợi, Màu Sắc Nổi Bật, Thiết Kế In Hình Sáng Tạo, Phụ Kiện Độc Đáo XLand P 0 5.00 4
40235 Bộ Sưu Tập Hoa Và Bướm, Bật Lửa Cricket, Bật Lửa Chủ Đề Nghệ Thuật, Hình Vẽ Ấn Tượng, Sản Phẩm Chất Lượng, Độ Bền Cao XLand P 0 5.00 3
4262 Giày Boot Denim Phối Da, Thời Trang Workwear, Boot Da Phối Denim, Giày Phong Cách Bụi Bặm, Boot Da Bò Thật Daddy's Shoes P 0 5.00 3
585 Cà Phê Rang Xay 250Gr, Cà Phê Rang Thủ Công, Cà Phê Lâm Đồng, Cà Phê Việt Nam, Cà Phê Hữu Cơ, Trồng Hữu Cơ, Nguyên Liệu Sạch Rin coffee P 0 5.00 10
48849 Bật Lửa Lý Long Đen Bọc Da Họa Tiết Vẽ Tay, Bật Lửa Nghệ Thuật, Hộp Quẹt Nghệ Thuật, Phụ Kiện Da, Quà Tặng Độc Đáo, Quà Tặng Cá Nhân Hóa ĐỎ P 0 5.00 12
2252 Ví Da Gập Kèm Ngăn Thẻ, Màu Sắc Và Chất Liệu Da Đa Dạng, Thiết Kế Nhỏ Gọn Tiện Lợi, Phong Cách Thời Thượng, Đựng Được Nhiều Đồ thanhsimone P 0 0
48042 Set Quà Nến Thơm Captain Of My Heart, BST Valentine's Day For Him - Thơm Một Cái Thơm Một Cái P 0