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 (
    29707, 29709, 29712, 29716, 29718, 29726, 
    29727, 29728, 29732, 29733, 29735, 
    29736, 29737, 29743, 29747, 29748, 
    29754, 29755, 29758, 29761, 29762, 
    29765, 29766, 29769, 29770, 29771, 
    29775, 29780, 29781, 29787
  ) 
  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.00089

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "86.01"
    },
    "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": 40,
        "rows_produced_per_join": 7,
        "filtered": "19.99",
        "index_condition": "(`portal`.`q_product_prices`.`product_id` in (29707,29709,29712,29716,29718,29726,29727,29728,29732,29733,29735,29736,29737,29743,29747,29748,29754,29755,29758,29761,29762,29765,29766,29769,29770,29771,29775,29780,29781,29787))",
        "cost_info": {
          "read_cost": "84.41",
          "eval_cost": "1.60",
          "prefix_cost": "86.01",
          "data_read_per_join": "191"
        },
        "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
29707 45.000000
29709 23.000000
29712 41.000000
29716 69.000000
29718 44.000000
29726 35.000000
29727 79.000000
29728 62.000000
29732 53.000000
29733 51.000000
29735 25.000000
29736 62.000000
29737 42.000000
29743 62.000000
29747 31.000000
29748 69.000000
29754 40.000000
29755 80.000000
29758 18.000000
29761 59.000000
29762 53.000000
29765 200.000000
29766 44.000000
29769 38.000000
29770 43.000000
29771 41.000000
29775 43.000000
29780 50.000000
29781 77.000000
29787 44.000000