SELECT 
  SQL_CALC_FOUND_ROWS products.product_id, 
  descr1.product as product, 
  companies.company as company_name, 
  popularity.total as popularity, 
  MIN(
    IF(
      prices.percentage_discount = 0, 
      prices.price, 
      prices.price - (
        prices.price * prices.percentage_discount
      )/ 100
    )
  ) as price, 
  products.product_type, 
  products.parent_product_id, 
  products.list_price as list_price, 
  MAX(
    100 - (
      (prices.price * 100) / products.list_price
    )
  ) AS sales_discount 
FROM 
  cscart_products as products 
  LEFT JOIN cscart_product_features_values ON cscart_product_features_values.product_id = products.product_id 
  AND cscart_product_features_values.lang_code = 'en' 
  LEFT JOIN cscart_product_features ON cscart_product_features_values.feature_id = cscart_product_features.feature_id 
  LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'en' 
  LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id 
  AND prices.lower_limit = 1 
  LEFT JOIN cscart_product_prices as prices_2 ON prices.product_id = prices_2.product_id 
  AND prices_2.lower_limit = 1 
  AND prices_2.price < prices.price 
  AND prices_2.usergroup_id IN (0, 0, 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 
  AND (
    cscart_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_categories.usergroup_ids
    )
  ) 
  AND cscart_categories.status IN ('A', 'H') 
  AND cscart_categories.storefront_id IN (0, 1) 
  LEFT JOIN cscart_product_popularity as popularity ON popularity.product_id = products.product_id 
  LEFT JOIN cscart_product_sales ON cscart_product_sales.product_id = products.product_id 
  AND cscart_product_sales.category_id = products_categories.category_id 
WHERE 
  1 
  AND companies.status IN ('A') 
  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 prices_2.price IS NULL 
  AND products.parent_product_id = 0 
  AND products.product_type != 'D' 
GROUP BY 
  products.product_id 
HAVING 
  sales_discount > 0 
  AND price < list_price 
ORDER BY 
  product asc, 
  products.product_id ASC 
LIMIT 
  0, 24

Query time 0.00538

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 5.01502926,
    "having_condition": "sales_discount > 0 and price < products.list_price",
    "filesort": {
      "sort_key": "descr1.product, products.product_id",
      "temporary_table": {
        "nested_loop": [
          {
            "table": {
              "table_name": "products",
              "access_type": "index",
              "possible_keys": ["PRIMARY", "status", "idx_parent_product_id"],
              "key": "PRIMARY",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "loops": 1,
              "rows": 1156,
              "cost": 0.2215076,
              "filtered": 54.51009369,
              "attached_condition": "products.parent_product_id = 0 and (products.usergroup_ids = '' or find_in_set(0,products.usergroup_ids) or find_in_set(1,products.usergroup_ids)) and products.`status` = 'A' and products.product_type <> 'D'"
            }
          },
          {
            "table": {
              "table_name": "cscart_product_features_values",
              "access_type": "ref",
              "possible_keys": [
                "lang_code",
                "product_id",
                "idx_product_feature_variant_id"
              ],
              "key": "product_id",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "ref": ["u508912950_dev_2025.products.product_id"],
              "loops": 630.1366782,
              "rows": 1,
              "cost": 0.614197393,
              "filtered": 100,
              "attached_condition": "trigcond(cscart_product_features_values.lang_code = 'en')",
              "using_index": true
            }
          },
          {
            "table": {
              "table_name": "descr1",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY", "product_id"],
              "key": "PRIMARY",
              "key_length": "9",
              "used_key_parts": ["product_id", "lang_code"],
              "ref": ["u508912950_dev_2025.products.product_id", "const"],
              "loops": 630.1366782,
              "rows": 1,
              "cost": 0.64308185,
              "filtered": 100,
              "attached_condition": "trigcond(descr1.lang_code = 'en')"
            }
          },
          {
            "table": {
              "table_name": "popularity",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY", "total"],
              "key": "PRIMARY",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "ref": ["u508912950_dev_2025.products.product_id"],
              "loops": 630.1366782,
              "rows": 1,
              "cost": 0.56607705,
              "filtered": 100
            }
          },
          {
            "table": {
              "table_name": "companies",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY"],
              "key": "PRIMARY",
              "key_length": "4",
              "used_key_parts": ["company_id"],
              "ref": ["u508912950_dev_2025.products.company_id"],
              "loops": 630.1366782,
              "rows": 1,
              "cost": 0.56443865,
              "filtered": 100,
              "attached_condition": "companies.`status` = 'A'"
            }
          },
          {
            "table": {
              "table_name": "prices",
              "access_type": "ref",
              "possible_keys": [
                "usergroup",
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "key": "usergroup",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "ref": ["u508912950_dev_2025.products.product_id"],
              "loops": 630.1366782,
              "rows": 1,
              "cost": 0.611906936,
              "filtered": 100,
              "attached_condition": "prices.lower_limit = 1 and prices.usergroup_id in (0,0,1)"
            }
          },
          {
            "table": {
              "table_name": "prices_2",
              "access_type": "ref",
              "possible_keys": [
                "usergroup",
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "key": "usergroup",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "ref": ["u508912950_dev_2025.products.product_id"],
              "loops": 630.1366782,
              "rows": 1,
              "cost": 0.611906936,
              "filtered": 100,
              "attached_condition": "trigcond(prices_2.price is null) and trigcond(prices_2.lower_limit = 1 and prices_2.price < prices.price and prices_2.usergroup_id in (0,0,1))",
              "not_exists": true
            }
          },
          {
            "table": {
              "table_name": "products_categories",
              "access_type": "ref",
              "possible_keys": ["PRIMARY", "pt"],
              "key": "pt",
              "key_length": "3",
              "used_key_parts": ["product_id"],
              "ref": ["u508912950_dev_2025.products.product_id"],
              "loops": 630.1366782,
              "rows": 1,
              "cost": 0.615016593,
              "filtered": 100,
              "using_index": true
            }
          },
          {
            "table": {
              "table_name": "cscart_categories",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY", "c_status", "p_category_id"],
              "key": "PRIMARY",
              "key_length": "3",
              "used_key_parts": ["category_id"],
              "ref": ["u508912950_dev_2025.products_categories.category_id"],
              "loops": 630.1366782,
              "rows": 1,
              "cost": 0.56689625,
              "filtered": 100,
              "attached_condition": "(cscart_categories.usergroup_ids = '' or find_in_set(0,cscart_categories.usergroup_ids) or find_in_set(1,cscart_categories.usergroup_ids)) and cscart_categories.`status` in ('A','H') and cscart_categories.storefront_id in (0,1)"
            }
          }
        ]
      }
    }
  }
}

Result

product_id product company_name popularity price product_type parent_product_id list_price sales_discount
13860 2in1 Face Primer & Serum Aden Cosmetics Malta 1008 14.50000000 P 0 21.00 30.952381
13439 Amyris 36Oils 313 6.50000000 P 0 12.00 45.833333
13440 Aniseed 36Oils 201 4.50000000 P 0 12.00 62.500000
14041 Armoire Pine Furniture Direct 42 395.00000000 P 0 450.00 12.222222
13441 Basil 36Oils 201 4.10000000 P 0 9.50 56.842105
13876 BB Cream Vegan Aden Cosmetics Malta 151 12.99000000 P 0 19.00 31.631579
13879 BB Cream With Collagen Aden Cosmetics Malta 176 9.80000000 P 0 19.00 48.421053
15167 Beach Straw Cloche Hat BP Beauty 75 5.00000000 P 0 12.00 58.333333
16346 Beaded Kiss-Lock Coin Purse BP Beauty 30 3.80000000 P 0 12.00 68.333333
14032 Bedside table Pine Furniture Direct 45 95.00000000 P 0 150.00 36.666667
14033 Bedside table Pine Furniture Direct 45 95.00000000 P 0 150.00 36.666667
14034 Bedside table Pine Furniture Direct 39 110.00000000 P 0 180.00 38.888889
16334 Bee Embellished Crossbody Phone Bag BP Beauty 72 5.50000000 P 0 15.00 63.333333
16348 Bee Embellished Wallet BP Beauty 49 4.80000000 P 0 15.00 68.000000
13442 Bergamot 36Oils 180 4.10000000 P 0 10.50 60.952381
13443 Birch Sweet 36Oils 186 4.10000000 P 0 10.50 60.952381
15749 Black Faux Leather Travel Pouch BP Beauty 30 7.60000000 P 0 19.00 60.000000
14660 Black Nylon Drawstring Bucket Bag BP Beauty 33 8.00000000 P 0 16.00 50.000000
13444 Black Pepper 36Oils 150 4.50000000 P 0 9.50 52.631579
14149 Blue Plush Sling Bag BP Beauty 36 22.00000000 P 0 35.00 37.142857
14650 Blush Wave Zip Wallet BP Beauty 39 4.60000000 P 0 14.00 67.142857
14024 Blusher Brush Angled Aden Cosmetics Malta 176 5.49000000 P 0 12.00 54.250000
13896 Blusher Palette Aden Cosmetics Malta 107 17.89000000 P 0 25.00 28.440000
16347 Brown Slim Card Holder Wallet BP Beauty 27 6.80000000 P 0 12.00 43.333333