WordPress transient doesn’t use the transient

I mean in shortly your code is wrong in the first line, the comparing is wrong. The variable $post should store = the data of the request via get_transient() and not compare ===.

So you should switch to:

if ( false === ( $posts = get_transient('posts_array') ) ) {
    // this code runs when there is no valid transient set
}