500 error on updating Craft
Step 01. 
Open your php.ini file.
File path for php 5.6: /etc/php/5.6/apache2/php.ini
File path for php 7.1: /etc/php/7.1/apache2/php.ini

Step 02:
Then increase max_exection_time from 30 to 300 or other as you like. 

Step 03:
Restart your server sudo service apache2 restart

Step 04:
Go to your web's root directory then run this command composer update

Now browse your site.