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 (
    9837, 9838, 9839, 9840, 9841, 9842, 9843, 
    9844, 9845, 9846, 9847, 9848, 9849, 
    9850, 9851, 9852, 9853, 9854, 9855, 
    9856, 9857, 9858, 9859, 9860, 9861, 
    9862, 9863, 9864, 9865, 9866, 9867, 
    9868
  ) 
  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.00085

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 (9837,9838,9839,9840,9841,9842,9843,9844,9845,9846,9847,9848,9849,9850,9851,9852,9853,9854,9855,9856,9857,9858,9859,9860,9861,9862,9863,9864,9865,9866,9867,9868))",
        "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
9837 139.000000
9838 139.000000
9839 169.000000
9840 105.000000
9841 104.000000
9842 115.000000
9843 139.000000
9844 149.000000
9845 149.000000
9846 68.990000
9847 79.000000
9848 79.000000
9849 68.990000
9850 79.000000
9851 64.990000
9852 61.990000
9853 149.000000
9854 179.000000
9855 179.000000
9856 179.000000
9857 179.000000
9858 179.000000
9859 199.000000
9860 199.000000
9861 105.000000
9862 105.000000
9863 105.000000
9864 99.000000
9865 149.000000
9866 149.000000
9867 139.000000
9868 209.000000