script for update game resources automatically in MySQL database

would you please tell me how I can update my MySQL database automatically when some event finished? for example when player send some resources to another player there is time should be appearing and when a time finished. the database should be updated automatically .even if the player was offline or browser was closed.

thanks for your time

Best Regards