UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z9uWvKwEJxbLVSZbwDGIPc2qnx5u21EWo7oFZUc8YxA='
WHERE
key_id = 'a8a52b46df20ce4f067cce68ff590fa917f69552f3e07ab183b5d67698301d38'
AND (
token = 'Z9uWvKwEJxbLVSZbwDGIPc2qnx5u21EWo7oFZUc8YxA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)