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 (
    6415, 6416, 6417, 6418, 6419, 6420, 6421, 
    6422, 6423, 6424, 6425, 6426, 6427, 
    6428, 6429, 6430, 6431, 6432, 6433, 
    6434, 6435, 6436, 6437, 6438, 6439, 
    6440, 6441, 6442, 6443, 6444, 6445, 
    6446, 6447, 6448, 6449, 6450, 6451, 
    6452, 6453, 6454, 6456, 6457, 6458, 
    6459, 6460, 6461, 6462, 6463, 6464, 
    6465, 6466, 6467, 6468, 6469, 6470, 
    6471, 6472, 6473, 6474, 6475, 6476, 
    6477, 6478, 6479
  ) 
  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.00154

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "153.61"
    },
    "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": 64,
        "rows_produced_per_join": 12,
        "filtered": "19.99",
        "index_condition": "(`portal`.`q_product_prices`.`product_id` in (6415,6416,6417,6418,6419,6420,6421,6422,6423,6424,6425,6426,6427,6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,6439,6440,6441,6442,6443,6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,6456,6457,6458,6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472,6473,6474,6475,6476,6477,6478,6479))",
        "cost_info": {
          "read_cost": "151.05",
          "eval_cost": "2.56",
          "prefix_cost": "153.61",
          "data_read_per_join": "307"
        },
        "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
6415 15.000000
6416 15.000000
6417 15.000000
6418 15.000000
6419 15.000000
6420 15.000000
6421 16.000000
6422 15.000000
6423 150.000000
6424 150.000000
6425 150.000000
6426 15.000000
6427 15.000000
6428 15.000000
6429 6.000000
6430 6.000000
6431 11.000000
6432 10.000000
6433 10.000000
6434 10.000000
6435 10.000000
6436 10.000000
6437 10.000000
6438 10.000000
6439 10.000000
6440 15.000000
6441 6.000000
6442 6.000000
6443 6.000000
6444 19.000000
6445 19.000000
6446 19.000000
6447 29.000000
6448 209.000000
6449 69.000000
6450 89.000000
6451 349.000000
6452 399.000000
6453 265.000000
6454 350.000000
6456 215.000000
6457 119.000000
6458 75.000000
6459 25.000000
6460 40.000000
6461 45.000000
6462 65.000000
6463 69.000000
6464 75.000000
6465 29.000000
6466 349.000000
6467 439.000000
6468 25.000000
6469 29.000000
6470 69.000000
6471 29.000000
6472 35.000000
6473 35.000000
6474 35.000000
6475 29.000000
6476 35.000000
6477 35.000000
6478 35.000000
6479 35.000000