SELECT 
  q_product_prices.product_id, 
  MIN(
    IF(
      q_product_prices.percentage_discount = 0, 
      q_product_prices.price, 
      q_product_prices.price - (
        q_product_prices.price * q_product_prices.percentage_discount
      )/ 100
    )
  ) AS price 
FROM 
  q_product_prices 
WHERE 
  q_product_prices.product_id IN (
    29252, 29290, 29292, 29321, 29344, 29351, 
    29352, 29385, 29387, 29388, 29391, 
    29394, 29682, 29685, 29687, 29692, 
    29704, 29707, 29709, 29712, 29718, 
    29732, 29733, 29735, 29736, 29737, 
    29747, 29748, 29754, 29766
  ) 
  AND q_product_prices.lower_limit = 1 
  AND q_product_prices.usergroup_id IN (0, 1) 
GROUP BY 
  q_product_prices.product_id

Query time 0.00096

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "81.81"
    },
    "grouping_operation": {
      "using_filesort": false,
      "table": {
        "table_name": "q_product_prices",
        "access_type": "range",
        "possible_keys": [
          "usergroup",
          "product_id",
          "lower_limit",
          "usergroup_id"
        ],
        "key": "product_id",
        "used_key_parts": [
          "product_id"
        ],
        "key_length": "3",
        "rows_examined_per_scan": 37,
        "rows_produced_per_join": 7,
        "filtered": "19.99",
        "index_condition": "(`portal`.`q_product_prices`.`product_id` in (29252,29290,29292,29321,29344,29351,29352,29385,29387,29388,29391,29394,29682,29685,29687,29692,29704,29707,29709,29712,29718,29732,29733,29735,29736,29737,29747,29748,29754,29766))",
        "cost_info": {
          "read_cost": "80.33",
          "eval_cost": "1.48",
          "prefix_cost": "81.81",
          "data_read_per_join": "177"
        },
        "used_columns": [
          "product_id",
          "price",
          "percentage_discount",
          "lower_limit",
          "usergroup_id"
        ],
        "attached_condition": "((`portal`.`q_product_prices`.`lower_limit` = 1) and (`portal`.`q_product_prices`.`usergroup_id` in (0,1)))"
      }
    }
  }
}

Result

product_id price
29252 97.000000
29290 44.000000
29292 59.000000
29321 68.000000
29344 26.000000
29351 54.000000
29352 62.000000
29385 71.000000
29387 33.000000
29388 53.000000
29391 35.000000
29394 51.000000
29682 44.000000
29685 34.000000
29687 41.000000
29692 56.000000
29704 52.000000
29707 45.000000
29709 23.000000
29712 41.000000
29718 44.000000
29732 53.000000
29733 51.000000
29735 25.000000
29736 62.000000
29737 42.000000
29747 31.000000
29748 69.000000
29754 40.000000
29766 44.000000