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 (
    30896, 30897, 30898, 30899, 30900, 30901, 
    30902, 30903, 30904, 30905, 30906, 
    30907, 30908, 30909, 30910, 30911, 
    30912, 30913, 30914, 30915, 30916, 
    30917, 30918, 30919, 30920, 30921, 
    30922, 30923, 30924, 30925, 30926, 
    30927
  ) 
  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.00101

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "76.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 (30896,30897,30898,30899,30900,30901,30902,30903,30904,30905,30906,30907,30908,30909,30910,30911,30912,30913,30914,30915,30916,30917,30918,30919,30920,30921,30922,30923,30924,30925,30926,30927))",
        "cost_info": {
          "read_cost": "75.53",
          "eval_cost": "1.28",
          "prefix_cost": "76.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
30896 36.000000
30897 36.000000
30898 36.000000
30899 36.000000
30900 36.000000
30901 36.000000
30902 27.000000
30903 36.000000
30904 36.000000
30905 64.000000
30906 81.000000
30907 36.000000
30908 36.000000
30909 36.000000
30910 81.000000
30911 36.000000
30912 36.000000
30913 36.000000
30914 17.000000
30915 36.000000
30916 126.000000
30917 63.000000
30918 66.320000
30919 652.000000
30920 36.000000
30921 36.000000
30922 206.000000
30923 36.000000
30924 81.000000
30925 61.000000
30926 36.000000
30927 36.000000