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 (
    40981, 40982, 40983, 40984, 40985, 40986, 
    40987, 40988, 40989, 40990, 40991, 
    40992, 40993, 40994, 40995, 40996, 
    40997, 40998, 40999, 41000, 41001, 
    41002, 41003, 41004, 41005, 41006, 
    41007, 41008, 41009, 41010, 41011, 
    41012
  ) 
  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.00084

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "81.01"
    },
    "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": 35,
        "rows_produced_per_join": 6,
        "filtered": "19.99",
        "index_condition": "(`portal`.`q_product_prices`.`product_id` in (40981,40982,40983,40984,40985,40986,40987,40988,40989,40990,40991,40992,40993,40994,40995,40996,40997,40998,40999,41000,41001,41002,41003,41004,41005,41006,41007,41008,41009,41010,41011,41012))",
        "cost_info": {
          "read_cost": "79.61",
          "eval_cost": "1.40",
          "prefix_cost": "81.01",
          "data_read_per_join": "167"
        },
        "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
40981 76.000000
40982 75.000000
40983 75.000000
40984 75.000000
40985 115.000000
40986 115.000000
40987 89.000000
40988 89.000000
40989 89.000000
40990 89.000000
40991 89.000000
40992 89.000000
40993 89.000000
40994 89.000000
40995 89.000000
40996 89.000000
40997 89.000000
40998 89.000000
40999 89.000000
41000 149.000000
41001 149.000000
41002 149.000000
41003 149.000000
41004 115.000000
41005 115.000000
41006 115.000000
41007 115.000000
41008 149.000000
41009 115.000000
41010 115.000000
41011 75.000000
41012 75.000000