UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tp/RNZMpe0rWRk5w5Cc+6sJU5zACfhRvKUBKcW+RS6Y='
WHERE
key_id = 'c9fbb34bf1ad960713f76883557a3bdb46f8f0fa443bb0353b07ac4366a95d46'
AND (
token = 'tp/RNZMpe0rWRk5w5Cc+6sJU5zACfhRvKUBKcW+RS6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)