Is there a way to change a .iso files volume id from the command line?

Volume ID is always stored at offset 0x8028 as 32 byte ASCII string. Edit it in place.

#!/usr/bin/perl
use strict;
use warnings;

die "Use: $0 <iso_file> <new volume id>\n" unless @ARGV == 2;
open my $file, "+<", $ARGV[0] or die "Cannot open: $!";
seek $file, 0x8028,0;
printf $file "%-32.32s", uc($ARGV[1]);

Test - (isovolid.pl is a name of the above script):

$ genisoimage -V A123456798012345678901234567890X -o aaa.iso *
$ isoinfo -d -i aaa.iso | grep 'Volume id:'
Volume id: A123456798012345678901234567890X
$ ./isovolid.pl aaa.iso NEWVOLUMEID
$ isoinfo -d -i aaa.iso | grep 'Volume id:'
Volume id: NEWVOLUMEID

xorriso can do this:

$ xorriso -dev ./VBoxGuestAdditions.iso -volid 'YourLable' -commit
xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project.

xorriso : NOTE : Loading ISO image tree from LBA 0
xorriso : UPDATE : 32 nodes read in 1 seconds
Drive current: -dev './VBoxGuestAdditions.iso'
Media current: stdio file, overwriteable
Media status : is written , is appendable
Media summary: 1 session, 29111 data blocks, 56.9m data, 20.3g free
Volume id    : 'VBOXADDITIONS_5.1.34_121010'
xorriso : WARNING : -volid text does not comply to ISO 9660 / ECMA 119 rules
ISO image produced: 27 sectors
Written to medium : 192 sectors at LBA 29120
Writing to './VBoxGuestAdditions.iso' completed successfully.

xorriso : NOTE : Re-assessing -outdev './VBoxGuestAdditions.iso'
xorriso : NOTE : Loading ISO image tree from LBA 0
xorriso : UPDATE : 32 nodes read in 1 seconds
Drive current: -dev './VBoxGuestAdditions.iso'
Media current: stdio file, overwriteable
Media status : is written , is appendable
Media summary: 1 session, 29147 data blocks, 56.9m data, 20.3g free
Volume id    : 'YourLable'
$