SELECT 
  AVG(a.cp_sred_rate) as val 
FROM 
  cscart_discussion_rating as a 
  LEFT JOIN cscart_discussion_posts as b ON a.post_id = b.post_id 
WHERE 
  a.thread_id IN (8228) 
  AND b.status = 'A' 
  AND a.rating_value > 0 
  AND b.cp_pr_user_delete = 'N'

Query time 0.00036

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "a",
          "access_type": "ref",
          "possible_keys": ["PRIMARY", "thread_id"],
          "key": "thread_id",
          "key_length": "3",
          "used_key_parts": ["thread_id"],
          "ref": ["const"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "a.rating_value > 0"
        }
      },
      {
        "table": {
          "table_name": "b",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["post_id"],
          "ref": ["lillyshop_lillyshop.a.post_id"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "b.`status` = 'A' and b.cp_pr_user_delete = 'N'"
        }
      }
    ]
  }
}

Result

val