UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7AkWb8gIsWoIRfmfTW/TQ7sZtNOxvFGi1AlAZKDazb8='
WHERE
key_id = '307c9c20aaa819e7c57e2a203fc987b13ccf109570dce68e3bf9ea5253896d74'
AND (
token = '7AkWb8gIsWoIRfmfTW/TQ7sZtNOxvFGi1AlAZKDazb8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)