SELECT 
  p.product_id, 
  ifnull(
    count(dp.post_id), 
    0
  ) as discussion_amount_posts 
FROM 
  cscart_discussion 
  INNER JOIN cscart_products as p ON (
    cscart_discussion.object_id = p.product_id
  ) 
  INNER JOIN cscart_discussion_posts as dp ON (
    cscart_discussion.thread_id = dp.thread_id 
    AND cscart_discussion.object_type = 'P'
  ) 
WHERE 
  dp.status = 'A' 
  and p.product_id in (
    2237, 11920, 2184, 2231, 2288, 2346, 
    2348, 2345, 2344, 2350, 2250, 2223, 
    13349, 2355, 2204, 2273, 2278, 2275, 
    2276, 2277, 2272, 2274, 4359, 2326, 
    2251, 2293, 2294, 2295, 2247, 2248
  ) 
GROUP BY 
  p.product_id

Query time 0.00035

JSON explain

{
  "query_block": {
    "select_id": 1,
    "filesort": {
      "sort_key": "p.product_id",
      "temporary_table": {
        "table": {
          "table_name": "dp",
          "access_type": "ALL",
          "possible_keys": ["thread_id", "thread_id_2"],
          "rows": 8,
          "filtered": 100,
          "attached_condition": "dp.`status` = 'A'"
        },
        "table": {
          "table_name": "cscart_discussion",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY", "object_id"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["thread_id"],
          "ref": ["ymonline_livedata.dp.thread_id"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "cscart_discussion.object_type = 'P'"
        },
        "table": {
          "table_name": "p",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["product_id"],
          "ref": ["ymonline_livedata.cscart_discussion.object_id"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "p.product_id in (2237,11920,2184,2231,2288,2346,2348,2345,2344,2350,2250,2223,13349,2355,2204,2273,2278,2275,2276,2277,2272,2274,4359,2326,2251,2293,2294,2295,2247,2248)",
          "using_index": true
        }
      }
    }
  }
}