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 (
    8440, 8441, 8442, 8443, 8444, 8445, 8446, 
    8447, 8449, 8450, 8451, 8452, 8453, 
    8454, 8455, 8457, 8458, 8459, 8460, 
    8461, 8462, 8463, 8464, 8465, 8466, 
    8467, 8468, 8469, 8470, 8471, 8472, 
    8473
  ) 
  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.00291

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 (8440,8441,8442,8443,8444,8445,8446,8447,8449,8450,8451,8452,8453,8454,8455,8457,8458,8459,8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471,8472,8473))",
        "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
8440 235.000000
8441 235.000000
8442 235.000000
8443 235.000000
8444 235.000000
8445 235.000000
8446 235.000000
8447 299.000000
8449 299.000000
8450 299.000000
8451 299.000000
8452 299.000000
8453 299.000000
8454 299.000000
8455 299.000000
8457 299.000000
8458 299.000000
8459 279.000000
8460 279.000000
8461 299.000000
8462 299.000000
8463 299.000000
8464 299.000000
8465 299.000000
8466 299.000000
8467 299.000000
8468 299.000000
8469 299.000000
8470 299.000000
8471 299.000000
8472 299.000000
8473 299.000000