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 (
    29790, 29793, 29794, 29796, 29800, 29801, 
    29806, 29813, 29818, 29825, 29829, 
    29832, 29833, 29834, 29835, 29836, 
    29838, 29843, 29849, 29850, 29852, 
    29854, 29860, 29862, 29864, 29876, 
    29878, 29904, 29905, 30349
  ) 
  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": "74.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": 32,
        "rows_produced_per_join": 6,
        "filtered": "19.99",
        "index_condition": "(`portal`.`q_product_prices`.`product_id` in (29790,29793,29794,29796,29800,29801,29806,29813,29818,29825,29829,29832,29833,29834,29835,29836,29838,29843,29849,29850,29852,29854,29860,29862,29864,29876,29878,29904,29905,30349))",
        "cost_info": {
          "read_cost": "73.53",
          "eval_cost": "1.28",
          "prefix_cost": "74.81",
          "data_read_per_join": "153"
        },
        "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
29790 62.000000
29793 44.000000
29794 54.000000
29796 59.000000
29800 62.000000
29801 61.000000
29806 301.000000
29813 19.000000
29818 79.000000
29825 78.000000
29829 37.000000
29832 41.000000
29833 48.000000
29834 51.000000
29835 40.000000
29836 49.000000
29838 52.000000
29843 122.000000
29849 45.000000
29850 42.000000
29852 43.000000
29854 56.000000
29860 61.000000
29862 61.000000
29864 38.000000
29876 69.000000
29878 23.000000
29904 42.000000
29905 62.000000
30349 49.000000