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 (
        38136, 38138, 38137, 387, 2039, 23152, 
        41344, 47921, 23267, 455, 5544, 4351, 
        4515, 2149, 48322, 734, 41339, 43817
      )
    ) 
    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.00593

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": 51.89157104,
              "index_condition": "products.product_id in (38136,38138,38137,387,2039,23152,41344,47921,23267,455,5544,4351,4515,2149,48322,734,41339,43817)",
              "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
43817 Bộ Quà Tặng Từ Tre Khắc Chữ Theo Yêu Cầu (Bình Giữ Nhiệt Và Ly Tre), Phụ Kiện Bếp Xanh, Ly Tre, Đồ Dùng Bằng Tre, Quà Tặng Độc Đáo, Quà Tặng Cá Nhân Hóa Tre Việt P 0 4.93 14
23152 Đũa Gỗ Trắc, Dụng Cụ Ăn Uống, Đũa Gỗ Cao Cấp, Không Hóa Chất, An Toàn Cho Sức Khoẻ, Quà Tặng Tân Gia, Quà Tặng Cá Nhân Hóa Tamy Beloved P 0 4.90 21
5544 Tương Ớt Xông Khói Saigon Sweet'N'Spicy, Tương Ớt Thủ Công, Hương Vị Việt Nam, Công Thức Gia Truyền, Nguyên Liệu Tự Nhiên, Ớt Tươi, Gia Vị Saigon Charlie's P 0 4.87 23
47921 Xe Nước Mía, Nam Châm Hít Tủ Lạnh, BST Xe Đẩy Hàng Rong 2, Quà Lưu Niệm Việt Nam, Quà Tặng Việt Nam Độc Đáo, Handmade, Mô Hình Thu Nhỏ The 90's DIY P 0 4.94 16
41339 Xe Hủ Tíu Gõ, Nam Châm Hít Tủ Lạnh, Bst Xe Đẩy Hàng Rong Sài Gòn, Quà Tặng Sài Gòn, Quà Lưu Niệm Sài Gòn, Nam Châm Handmade, Trang Trí Tủ Lạnh, Phong Cách Sài Gòn, Quà Tặng Độc Đáo, Quà Tặng Việt Nam The 90's DIY P 0 4.69 36
387 Sổ Tay Giấy Kraft “Saigon In My Heart”, Bìa Dày Dặn, Chất Liệu Giấy Mềm Mịn, Khả Năng Bám Mực Tốt, Phong Cách Cổ Điển Sổ tay việt P 0 5.00 7
23267 Cốc Cà Phê Danh Lam Thắng Cảnh, Sứ Mạ Vàng, Gốm Sứ Việt Nam, Men Bóng, Gốm Thủ Công, Nâng Tầm Không Gia, Quà Tặng Cà Phê, Quà Việt Nam Gốm Đông Gia P 0 4.94 17
455 Bộ Cờ Tỷ Phú Sài Gòn Bằng Gỗ - Maztermind THE CRAFT HOUSE P 0 5.00 7
38137 Ví Thái Nắp Gập 02, Mẫu Mã Đa Dạng. Màu Sắc Sặc Sỡ, Phối Màu Hài Hoà, Hoạ Tiết Truyền Thống Tây Bắc, Sản Phẩm Thủ Công, Thổ Cẩm PIÊU - Brocade Decor P 0 5.00 1
734 Gấu Bông Thổ Cẩm, Gấu Bông Siêu Đáng Yêu, Gấu Bông Chất Lượng Cao, Đồ Chơi Thủ Công, Thú Nhồi Bông Hình Gấu, Món Quà Cho Bé Thổ Cẩm PIÊU - Brocade Decor P 0 5.00 3
4515 Bưu Thiếp Bia Sài Gòn, Thiệp Lưu Niệm Bia Sài Gòn, Quà Tặng Đặc Biệt, Ý Nghĩa, Quà Tặng Niệm, Văn Hóa Việt Nam OHQUAO P 0 5.00 22
4351 Sông Sài Gòn, Tranh In Từ Tranh Khắc Gỗ Size Lớn, Khắc Hoạ Vẻ Đẹp Nên Thơ Của Sài Gòn, Giấy In Chất Lượng Cao, Không Bị Phai Màu Saigon Print Shop P 0 5.00 1
38136 Ví Thổ Cẩm Vuông Nhiều Ngăn, Dệt Thủ Công Từ Sợi Bông, Thiết Kế Ví Cầm Tay Nhỏ Gọn, Phụ Kiện Đậm Chất Truyền Thống Thổ Cẩm PIÊU - Brocade Decor P 0 5.00 1
2149 Sổ Tay Bìa Vải Nhuộm Màu, Khổ A5, Bìa Sổ Bọc Vải Chắc Chắn, Không Phai Màu, Thiết Kế Lạ Mắt, Chất Liệu Giấy Tốt, Phù Hợp Làm Sổ Học Tập Hoa Tiến Brocade P 0 5.00 1
38138 Băng Đô Thổ Cẩm, Hoạ Tiết Thổ Cẩm Mộc Mạc, Chất Liệu Mềm Mại Cho Tóc, Phù Hợp Với Nhiều Kiểu Tóc, Phụ Kiện Xinh Xắn Cho Tóc Thổ Cẩm PIÊU - Brocade Decor P 0 5.00 2
48322 Nam Châm Mô Hình Xe Bánh Mì Việt Nam, Bst Little Viet Nam, Nam Châm Trang Trí Tủ Lạnh, Văn Hoá Việt, Thiết Kế Chi Tiết, Mô Hình Thủ Công Nhà Tin P 0 5.00 1