SELECT 
  cscart_product_prices.product_id, 
  MIN(
    IF(
      cscart_product_prices.percentage_discount = 0, 
      cscart_product_prices.price, 
      cscart_product_prices.price - (
        cscart_product_prices.price * cscart_product_prices.percentage_discount
      )/ 100
    )
  ) AS price 
FROM 
  cscart_product_prices 
WHERE 
  cscart_product_prices.product_id IN (
    31638, 3870, 114, 47923, 1582, 2143, 
    33312, 31633, 31632, 3287, 3286, 3872, 
    113, 5300, 3517, 5991, 2144, 3516, 33744, 
    5297, 1980, 1103, 65, 5543, 31634, 5784, 
    41281, 6652, 3518, 41282, 40445, 40442
  ) 
  AND cscart_product_prices.lower_limit = 1 
  AND cscart_product_prices.usergroup_id IN (0, 1) 
GROUP BY 
  cscart_product_prices.product_id

Query time 0.00210

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "cscart_product_prices",
          "access_type": "range",
          "possible_keys": [
            "usergroup",
            "product_id",
            "lower_limit",
            "usergroup_id"
          ],
          "key": "product_id",
          "key_length": "3",
          "used_key_parts": ["product_id"],
          "rows": 32,
          "filtered": 99.9960556,
          "index_condition": "cscart_product_prices.product_id in (31638,3870,114,47923,1582,2143,33312,31633,31632,3287,3286,3872,113,5300,3517,5991,2144,3516,33744,5297,1980,1103,65,5543,31634,5784,41281,6652,3518,41282,40445,40442)",
          "attached_condition": "cscart_product_prices.lower_limit = 1 and cscart_product_prices.usergroup_id in (0,1)"
        }
      }
    ]
  }
}

Result

product_id price
65 800000.0000
113 160000.0000
114 140000.0000
1103 583000.0000
1582 55000.0000
1980 22032.0000
2143 96000.0000
2144 96000.0000
3286 3500000.0000
3287 3500000.0000
3516 169000.0000
3517 169000.0000
3518 169000.0000
3870 190000.0000
3872 1200000.0000
5297 552000.0000
5300 552000.0000
5543 75000.0000
5784 231000.0000
5991 82000.0000
6652 88000.0000
31632 55000.0000
31633 135000.0000
31634 135000.0000
31638 135000.0000
33312 535000.0000
33744 28000.0000
40442 180000.0000
40445 230000.0000
41281 63000.0000
41282 63000.0000
47923 295000.0000