All invoicing systems have to deal with the same issue. If you change the price of an item in your products table, that price change can't be allowed to change the price charged on an invoice created before the price change.
This is handled by copying the current rate into each new line item record as it is created. This copied unit price is then multiplied against the quantity field to compute the cost for that line item.
You can specify an hourly rate in your client table, but use a looked up value auto-enter setting in field options to copy that rate into the table where you log the hours worked for that client. If you later decide to change the rate for that client, the rate in existing records logging your time for them will not change.