在数组值中合并ID上的多个dim数组

I have a bigger multi dim array I pull from a db.

array(43593) {
  [0]=>
  array(4) {
    ["artnum"]=>
    string(5) "0422272221"
    ["ekprice"]=>
    string(5) "52.78"
    ["ekpriceist"]=>
    string(5) "52.78"
    ["lieferantnr"]=>
    string(7) "7000202"
  }
  [1]=>
  array(4) {
    ["artnum"]=>
    string(5) "04233337133333"
    ["ekprice"]=>
    string(5) "49.45"
    ["ekpriceist"]=>
    string(5) "49.45"
    ["lieferantnr"]=>
    string(7) "7000211"
  }

from another DB server I pull this array

array(73287) {
  [0]=>
  array(2) {
    ["ARTNUM"]=>
    string(5) "0422272221"
    ["QUALITAETSMERKMAL"]=>
    string(1) "p"
  }
  [1]=>
  array(2) {
    ["ARTNUM"]=>
    string(5) "04233337133333"
    ["QUALITAETSMERKMAL"]=>
    string(1) "m"
  }

When I excecute the following from user interface

foreach($aStockArticles as $aStockArticle) {

                foreach($aArticleStamm as $artikel)
                        {           
                            if($aStockArticle['artnum'] == $artikel['artnum'])
                            {
                                $aStockArticle['quality']  = $artikel['QUALITAETSMERKMAL'];
                            }
                        }   }

I recieve

[line 451] [code ] [message Maximum execution time of 30 seconds exceeded]

As you can see, the amount of articles and the sequence they are ordered can differ from each other.

Since I have no access environment variables I usually would do a simple join in the db query but in this case its not possible due to the two db servers.

QUESTION: How do I merge these arrays on the ID (artnum)?

So it looks like the following and stay within the excecution time?

array(43593) {
  [0]=>
  array(4) {
    ["artnum"]=>
    string(5) "0422272221"
    ["ekprice"]=>
    string(5) "52.78"
    ["ekpriceist"]=>
    string(5) "52.78"
    ["lieferantnr"]=>
    string(7) "7000202"
    ["QUALITAETSMERKMAL"]=>
    string(1) "p"
  }
  [1]=>
  array(4) {
    ["artnum"]=>
    string(5) "04233337133333"
    ["ekprice"]=>
    string(5) "49.45"
    ["ekpriceist"]=>
    string(5) "49.45"
    ["lieferantnr"]=>
    string(7) "7000211"
    ["QUALITAETSMERKMAL"]=>
    string(1) "m"
  }