SELECT 
  product_prices.product_id, 
  MIN(
    IF(
      product_prices.percentage_discount = 0, 
      product_prices.price, 
      product_prices.price - (
        product_prices.price * product_prices.percentage_discount
      )/ 100
    )
  ) AS price 
FROM 
  product_prices 
WHERE 
  product_prices.product_id IN (
    138903, 171934, 139416, 139364, 139389, 
    139360, 138902, 139368, 173441, 139376, 
    139318, 139415, 139314, 139315, 139377, 
    149277, 139381, 139366, 139363, 139387, 
    139379, 139418, 139321, 139361, 139419, 
    173429, 149275, 139380, 139355, 139358, 
    139372, 139383, 139390, 138901, 173431, 
    173432, 149249, 173426, 138899, 173436, 
    149261, 149274, 139370, 173443, 139367, 
    173438, 139385, 149278
  ) 
  AND product_prices.lower_limit = 1 
  AND product_prices.usergroup_id IN (0, 1) 
GROUP BY 
  product_prices.product_id

Query time 0.00155

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "39.86"
    },
    "grouping_operation": {
      "using_filesort": false,
      "table": {
        "table_name": "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": 48,
        "rows_produced_per_join": 4,
        "filtered": "10.00",
        "index_condition": "(`goimagine`.`product_prices`.`product_id` in (138903,171934,139416,139364,139389,139360,138902,139368,173441,139376,139318,139415,139314,139315,139377,149277,139381,139366,139363,139387,139379,139418,139321,139361,139419,173429,149275,139380,139355,139358,139372,139383,139390,138901,173431,173432,149249,173426,138899,173436,149261,149274,139370,173443,139367,173438,139385,149278))",
        "cost_info": {
          "read_cost": "39.39",
          "eval_cost": "0.48",
          "prefix_cost": "39.87",
          "data_read_per_join": "115"
        },
        "used_columns": [
          "id",
          "product_id",
          "price",
          "percentage_discount",
          "lower_limit",
          "usergroup_id"
        ],
        "attached_condition": "((`goimagine`.`product_prices`.`lower_limit` = 1) and (`goimagine`.`product_prices`.`usergroup_id` in (0,1)))"
      }
    }
  }
}

Result

product_id price
138899 10.00000000
138901 10.00000000
138902 10.00000000
138903 10.00000000
139314 8.00000000
139315 8.00000000
139318 8.00000000
139321 8.00000000
139355 8.00000000
139358 8.00000000
139360 8.00000000
139361 8.00000000
139363 8.00000000
139364 8.00000000
139366 8.00000000
139367 8.00000000
139368 6.00000000
139370 6.00000000
139372 6.00000000
139376 6.00000000
139377 6.00000000
139379 8.00000000
139380 8.00000000
139381 8.00000000
139383 8.00000000
139385 8.00000000
139387 8.00000000
139389 8.00000000
139390 8.00000000
139415 8.00000000
139416 8.00000000
139418 8.00000000
139419 8.00000000
149249 10.00000000
149261 10.00000000
149274 8.00000000
149275 8.00000000
149277 8.00000000
149278 8.00000000
171934 10.00000000
173426 12.00000000
173429 12.00000000
173431 12.00000000
173432 12.00000000
173436 12.00000000
173438 12.00000000
173441 12.00000000
173443 12.00000000