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 (
    4109, 4032, 4033, 4034, 4035, 4036, 4164, 
    4161, 4162, 4175, 4176, 4177, 4178, 
    4179, 4180, 4181, 4182, 4183, 4184, 
    4185, 4186, 4187, 4188, 4192, 4193, 
    4194, 4195, 4199, 4200, 4201, 4202, 
    4367, 4020, 4021, 4022, 4023, 3934, 
    3932, 3970, 4024, 4014, 4065, 4113, 
    4086, 4089, 4092, 4093, 4097, 4018, 
    4028, 3929, 4052, 4010, 3955, 4150, 
    4151, 4050, 3930, 4189, 4037, 4038, 
    4039, 4040, 4025, 4119, 4126, 4127, 
    4072, 4145, 4146, 4147, 4060, 3974, 
    4041, 4103, 4148, 4102, 4366, 4064, 
    4062, 4101, 4063, 4074, 4075, 4076, 
    4077, 4078, 4079, 4080
  ) 
GROUP BY 
  p.product_id

Query time 0.00039

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 (4109,4032,4033,4034,4035,4036,4164,4161,4162,4175,4176,4177,4178,4179,4180,4181,4182,4183,4184,4185,4186,4187,4188,4192,4193,4194,4195,4199,4200,4201,4202,4367,4020,4021,4022,4023,3934,3932,3970,4024,4014,4065,4113,4086,4089,4092,4093,4097,4018,4028,3929,4052,4010,3955,4150,4151,4050,3930,4189,4037,4038,4039,4040,4025,4119,4126,4127,4072,4145,4146,4147,4060,3974,4041,4103,4148,4102,4366,4064,4062,4101,4063,4074,4075,4076,4077,4078,4079,4080)",
          "using_index": true
        }
      }
    }
  }
}