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 
  24, 24

Query time 0.00397

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
13445 Cabreuva 36Oils 159 4.90000000 P 0 9.90 50.505051
13446 Carrot Seed 36Oils 161 7.70000000 P 0 10.20 24.509804
13447 Cassia 36Oils 165 5.30000000 P 0 8.50 37.647059
13448 Cedarwood Atlas 36Oils 159 4.10000000 P 0 9.50 56.842105
15166 Chain Trim Fedora BP Beauty 30 6.50000000 P 0 12.00 45.833333
15732 Chain Trim Felt Fedora BP Beauty 30 6.50000000 P 0 12.00 45.833333
18508 Chaz Kangeroo Hoodie Surf Shop 1004 20.00000000 P 0 25.00 20.000000
13504 Citrus & Aloe Toner - 125ML 36Oils 86 8.00000000 P 0 14.00 42.857143
13449 Clary Sage 36Oils 111 7.30000000 P 0 10.50 30.476190
14651 Classic Wave Zip Wallet – Black & Beige BP Beauty 21 4.75000000 P 0 11.00 56.818182
14140 Cloud Tote Bag BP Beauty 93 18.00000000 P 0 27.99 35.691318
13450 Clove Bud 36Oils 120 4.10000000 P 0 8.50 51.764706
13946 COLOR-ME Eyebrow Pencil Aden Cosmetics Malta 63 11.99000000 P 0 22.49 46.687417
13916 COLOR-ME Eyeliner Aden Cosmetics Malta 82 4.99000000 P 0 15.99 68.792996
13963 COLOR-ME Lipliner Pencil Aden Cosmetics Malta 60 4.59000000 P 0 15.99 71.294559
13919 COLOR-ME Matic Eyeshaper Aden Cosmetics Malta 87 6.40000000 P 0 19.49 67.162648
13929 COLOR-ME Super Intelligent Mascara - BLACK Aden Cosmetics Malta 63 9.69000000 P 0 19.49 50.282196
13932 COLOR-ME Ultra Volume Mascara - BLACK Aden Cosmetics Malta 64 9.59000000 P 0 19.49 50.795280
13895 Contouring Palette Aden Cosmetics Malta 99 17.89000000 P 0 27.49 34.921790
14020 Cosmetic Twin Sharpener Aden Cosmetics Malta 158 3.50000000 P 0 10.99 68.152866
14656 Coveri Green Nylon Backpack BP Beauty 12 18.00000000 P 0 25.99 30.742593
14654 Coveri Nylon Women's Backpack BP Beauty 30 18.00000000 P 0 25.99 30.742593
14661 Coveri Teal Backpack BP Beauty 3 18.00000000 P 0 25.99 30.742593
13899 Cream Camouflage Aden Cosmetics Malta 147 8.99000000 P 0 16.29 44.812769