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 (
    8501, 8503, 8504, 8506, 8507, 8508, 8509, 
    8510, 8511, 8512, 8514, 8515, 8516, 
    8517, 8518, 8519, 8521, 8477, 8476, 
    8474, 8377, 8376, 8375, 8374, 8368, 
    8367, 8272, 8271, 8270, 8269, 8268, 
    8267
  ) 
  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.00094

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 (8501,8503,8504,8506,8507,8508,8509,8510,8511,8512,8514,8515,8516,8517,8518,8519,8521,8477,8476,8474,8377,8376,8375,8374,8368,8367,8272,8271,8270,8269,8268,8267))",
        "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
8267 149.000000
8268 169.000000
8269 9.000000
8270 29.000000
8271 9.000000
8272 99.000000
8367 75.000000
8368 24.000000
8374 19.000000
8375 19.000000
8376 19.000000
8377 6.000000
8474 105.000000
8476 39.000000
8477 45.000000
8501 89.000000
8503 85.000000
8504 129.000000
8506 169.000000
8507 109.000000
8508 55.000000
8509 169.000000
8510 369.000000
8511 239.000000
8512 169.000000
8514 169.000000
8515 139.000000
8516 169.000000
8517 189.000000
8518 239.000000
8519 89.000000
8521 155.000000