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' 
    AND cscart_discussion.company_id = 1
  ) 
WHERE 
  dp.status = 'A' 
  and p.product_id in (
    278, 280, 282, 247, 248, 241, 244, 245, 
    246, 240, 6, 66, 166, 214, 219, 221, 223, 
    192, 194, 195, 196, 197, 198, 199, 200, 
    201, 202, 203, 204, 205, 206, 207, 208, 
    209, 210, 211, 212, 213, 215, 217, 218, 
    220, 222, 224, 225, 226, 227, 228, 229, 
    230, 231, 232, 233, 234, 235, 236, 237, 
    238, 239, 242, 243, 78, 79, 80, 81, 82, 
    83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 
    93, 94, 95, 96, 97, 100, 101, 102, 103, 
    104, 105, 106, 107, 108, 109, 110, 111, 
    112, 113, 114
  ) 
GROUP BY 
  p.product_id

Query time 0.00068

JSON explain

{
  "query_block": {
    "select_id": 1,
    "filesort": {
      "sort_key": "p.product_id",
      "temporary_table": {
        "nested_loop": [
          {
            "table": {
              "table_name": "dp",
              "access_type": "ALL",
              "possible_keys": ["thread_id", "thread_id_2"],
              "rows": 17,
              "filtered": 100,
              "attached_condition": "dp.`status` = 'A'"
            }
          },
          {
            "table": {
              "table_name": "cscart_discussion",
              "access_type": "eq_ref",
              "possible_keys": ["PRIMARY", "object_id", "idx_company_id"],
              "key": "PRIMARY",
              "key_length": "3",
              "used_key_parts": ["thread_id"],
              "ref": ["n764025_kutubminar123.dp.thread_id"],
              "rows": 1,
              "filtered": 100,
              "attached_condition": "cscart_discussion.company_id = 1 and 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": ["n764025_kutubminar123.cscart_discussion.object_id"],
              "rows": 1,
              "filtered": 100,
              "attached_condition": "p.product_id in (278,280,282,247,248,241,244,245,246,240,6,66,166,214,219,221,223,192,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,215,217,218,220,222,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,242,243,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114)",
              "using_index": true
            }
          }
        ]
      }
    }
  }
}

Result

product_id discussion_amount_posts
78 1
224 2
228 2
238 1
239 1
242 2