<?php
$array = array(
'post_type' => 'post_type',
'tax_query' => array(
array(
'taxonomy' = 'taxonomy',
'field' => 'id',
'terms' => array( 1, 2, 3 ),
)
)
);
$query = new WP_Query;
$my_query = $query->query($array );
foreach( $my_query as $post ){
update_post_meta($post->ID, 'key', 'value');
}