UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gh6lfhA3340eQ3gpyL454VElMKTj7S+cpIwN5/em/n0='
WHERE
key_id = 'd0a240f42f487657593e011f624f7956470eda27512983879f9cad49f89b9b7f'
AND (
token = 'gh6lfhA3340eQ3gpyL454VElMKTj7S+cpIwN5/em/n0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)