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 (
    3934, 3935, 3936, 3937, 3955, 3956, 3957, 
    3970, 3971, 3972, 3973, 3974, 3975, 
    3976, 4010, 4011, 4050, 4051, 4052, 
    4053, 4060, 4061, 4064, 4365, 4065, 
    4066, 4072, 4089, 4090, 4091, 4093, 
    4094, 4095, 4096, 4097, 4098, 4099, 
    4100, 4119, 4120, 4121, 4122, 4123, 
    4124, 4162, 4163, 4164, 4165, 4166, 
    4167, 4168, 4169, 4170, 4171, 4173, 
    4174, 4185, 4189, 4190, 4191, 4195, 
    4196, 4197, 4198, 4202, 4203, 4367
  ) 
GROUP BY 
  p.product_id

Query time 0.00049

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 (3934,3935,3936,3937,3955,3956,3957,3970,3971,3972,3973,3974,3975,3976,4010,4011,4050,4051,4052,4053,4060,4061,4064,4365,4065,4066,4072,4089,4090,4091,4093,4094,4095,4096,4097,4098,4099,4100,4119,4120,4121,4122,4123,4124,4162,4163,4164,4165,4166,4167,4168,4169,4170,4171,4173,4174,4185,4189,4190,4191,4195,4196,4197,4198,4202,4203,4367)",
          "using_index": true
        }
      }
    }
  }
}